home *** CD-ROM | disk | FTP | other *** search
/ PC Direct 1998 August / PC Direct August 1998.iso / S / powerj / Product / hpp.z / WOLEIFAM.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-25  |  6.6 KB  |  195 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of WATCOM International Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. /*************************************************************************
  12.  *
  13.  * WOleInterfaceFamily -- Ole Interface Family class
  14.  *
  15.  *
  16.  *   Events:
  17.  *
  18.  *      Create                  -- Create event
  19.  *
  20.  *      Destroy                 -- Destroy event
  21.  *
  22.  *      AboutToDestroy          -- AboutToDestroy event
  23.  *
  24.  *
  25.  *************************************************************************/
  26.  
  27. #ifndef _WOLEIFAM_HPP_INCLUDED
  28. #define _WOLEIFAM_HPP_INCLUDED
  29.  
  30. #ifndef _WNO_PRAGMA_PUSH
  31. #pragma pack(push,8);
  32. #pragma enum int;
  33. #endif
  34.  
  35. #ifndef _WOLETYPE_HPP_INCLUDED
  36. #   include "woletype.hpp"
  37. #endif
  38. #ifndef _WOLESOBJ_HPP_INCLUDED
  39. #   include "wolesobj.hpp"
  40. #endif
  41.  
  42. // forward class declarations
  43. class WCMCLASS wllist_header;
  44. class WCMCLASS WApplication;
  45.  
  46. class WCMCLASS WOleInterfaceFamilyRegistryData {
  47.     public:
  48.         WOleInterfaceFamilyRegistryData( const WCLSID & clsid, void * );
  49.         ~WOleInterfaceFamilyRegistryData( void );
  50.  
  51.         // Properties
  52.         WBool SetRegistryDataBlock( void * );
  53.         void *GetRegistryDataBlock( void ) const;
  54.  
  55.         // Self Registration
  56.         virtual WBool Register( WApplication * );
  57.         virtual WBool Unregister( WApplication * );
  58.  
  59.         WCLSID                                  _classID;
  60.         static WOleInterfaceFamilyRegistryData  *Head;
  61.         WOleInterfaceFamilyRegistryData         *next;
  62.  
  63.     private:
  64.         void                                   *_registryDataBlock;
  65. };
  66.  
  67. // the following is definitions of WOleInterfaceFamily
  68.  
  69. class WCMCLASS WOleInterfaceFamily : public WEventGenerator {
  70.     WDeclareSubclass( WOleInterfaceFamily, WEventGenerator );
  71.  
  72.     public:
  73.  
  74.         /**********************************************************
  75.          * Constructors and Destructors
  76.          *********************************************************/
  77.  
  78.         // Aggregating IUnknown ( unkOuter )
  79.         //    This class will NOT call AddRef through the IUnknown
  80.         //    pointer nor will it call Release in its destructor.
  81.         //    This is to avoid circular reference counts as
  82.         //    The implementor on the aggregating IUnknown is expected
  83.         //    to control the lifetime of the instance of this class.
  84.         WOleInterfaceFamily( WOleServerObject *serverObject );
  85.  
  86.         virtual ~WOleInterfaceFamily();
  87.  
  88.     public:
  89.  
  90.         /**************************************************************
  91.          * Properties
  92.          **************************************************************/
  93.  
  94.         // Class Name
  95.         WString GetName( void ) const;
  96.  
  97.         /**************************************************************
  98.          * Static Methods
  99.          **************************************************************/
  100.  
  101.         // Self Registration
  102.         static WBool Register( WApplication *application );
  103.         static WBool Unregister( WApplication *application );
  104.  
  105.         /**************************************************************
  106.          * Methods
  107.          **************************************************************/
  108.  
  109.         // overrides
  110.  
  111.         virtual WBool Destroy( void );
  112.  
  113.         virtual WBool AboutToDestroy( void );
  114.  
  115.         // Query Interface
  116.         //    The object that owns the aggregating IUnknown pointer
  117.         //    ( usually a WOleServerObject ) will call this method
  118.         //    to retrieve pointers to interface implementations.
  119.         //    NOTE: DO NOT AddRef the returned "iface" this is done by the
  120.         //          server object
  121.         virtual WBool QueryInterface( const WCLSID & clsid, void **iface );
  122.  
  123.     /**********************************************************
  124.      * Data Members
  125.      *********************************************************/
  126.     
  127.     protected:
  128.         WOleServerObject                *_serverObject;
  129.         WPIUnknown                      _unkOuter;
  130.         WString                         _name;
  131.  
  132. };
  133.  
  134. /*************************************************************************
  135.  *
  136.  * WOleGenericInterfaceFamily -- Generic Ole Interface Family class
  137.  *
  138.  *
  139.  *   Events:
  140.  *
  141.  *************************************************************************/
  142.  
  143. class WCMCLASS WOleGenericInterfaceFamily : public WOleInterfaceFamily {
  144.     WDeclareSubclass( WOleGenericInterfaceFamily, WOleInterfaceFamily );
  145.  
  146.     public:
  147.  
  148.         /**********************************************************
  149.          * Constructors and Destructors
  150.          *********************************************************/
  151.  
  152.         // Aggregating IUnknown ( unkOuter )
  153.         //    This class will NOT call AddRef through the IUnknown
  154.         //    pointer nor will it call Release in its destructor.
  155.         //    This is to avoid circular reference counts as
  156.         //    The implementor on the aggregating IUnknown is expected
  157.         //    to control the lifetime of the instance of this class.
  158.         WOleGenericInterfaceFamily( WOleServerObject *serverObject );
  159.  
  160.         virtual ~WOleGenericInterfaceFamily();
  161.  
  162.     public:
  163.  
  164.         /**************************************************************
  165.          * Properties
  166.          **************************************************************/
  167.  
  168.         /**************************************************************
  169.          * Methods
  170.          **************************************************************/
  171.  
  172.         virtual WBool QueryInterface( const WCLSID & clsid, void **iface );
  173.  
  174.         // Add
  175.         WBool AddInterface( const WCLSID & wclsid, WPIUnknown pIUnknown );
  176.  
  177.     /**********************************************************
  178.      * Data Members
  179.      *********************************************************/
  180.     
  181.     protected:
  182.         wllist_header           *_interfaceList;
  183. };
  184.  
  185. #define WOleDefineInterfaceFamily( c, c_id, rdb ) \
  186.     static WOleInterfaceFamilyRegistryData _WOleIntFamRegistryData( c_id, (void*)&rdb );
  187.  
  188. #ifndef _WNO_PRAGMA_PUSH
  189. #pragma enum pop;
  190. #pragma pack(pop);
  191. #endif
  192.  
  193. #endif // _WOLEIFAM_HPP_INCLUDED
  194.  
  195.